package Exception;

import java.rmi.RemoteException;

import javax.naming.InsufficientResourcesException;

public class ThrowsTest {
    
    public static void main(String[] args)  {
        try 
        {
            withdraw(0);
        } 
        catch (RemoteException e) {

        }
        catch (InsufficientResourcesException e) {

        }
    }

    /**
     * 如果一个方法没有捕获到一个检查性异常，那么该方法必须使用 throws 关键字来声明
     * throws关键词，用来告诉此方法的调用者，必须要处理该异常，否则编译无法通过
     * @param amount
     * @throws RemoteException
     * @throws InsufficientResourcesException
     */
    public static void withdraw(double amount) throws RemoteException,InsufficientResourcesException
    {
        throw new RemoteException();
    }
}
